<template>
	<view :class="[`${PREFIX}`]">
		<view :class="[`${PREFIX}-head`]">
			<CInput :class="[`${PREFIX}-head-input`]" placeholder="搜索用户" @focus="focus" />
			<image src="../../static/common/select.png" mode="" @click="doSelect"></image>
		</view>
		<view :class="[`${PREFIX}-list`]">
			<Friend v-for="item in 5" />
		</view>
		<view :class="[`${PREFIX}-select`]" v-if="showSelect">
			<Select @sureSelect="sureSelect" />
		</view>
		<u-popup :show="show" mode="bottom" round="10">
			<view :class="[`${PREFIX}-popup`]">
				<view :class="[`${PREFIX}-popup-title`]">
					<image src="../../static/friends/close.png" mode="" @click="close"></image>
					欢迎
				</view>
				<view :class="[`${PREFIX}-popup-tips`]">你们看起来很合适</view>
				<Friend v-for="item in 5" :showSelect="true"/>
				<view :class="[`${PREFIX}-popup-btnwrap`]">
					<CButton text="一键关注"></CButton>
				</view>
			</view>
		</u-popup>
	</view>
</template>
<script>
	const PREFIX = 'friends'
	import CInput from '../../components/CInput.vue'
	import Friend from './components/Friend.vue'
	import Select from './components/Select.vue'
	import CButton from '../../components/CButton.vue'
	export default {
		data() {
			return {
				PREFIX,
				showSelect: false,
				show: true
			}
		},
		components: {
			CInput,
			Friend,
			Select,
			CButton
		},
		methods: {
			focus() {
				console.log('xxxx');
			},
			doSelect() {
				this.showSelect = true
			},
			sureSelect() {
				console.log('xxxxxxxx');
				this.showSelect = false
			},
			close(){
				this.show = false
			}
		}
	}
</script>
<style lang="less">
	page {
		background: #fff;
	}

	.friends {
		position: relative;

		&-head {
			display: flex;
			padding: 0 36rpx;
			align-items: center;

			&-input {
				flex: 1;
				margin-right: 32rpx;
			}

			image {
				width: 40rpx;
				height: 40rpx;
			}
		}

		&-select {
			width: 100%;
			position: absolute;
			left: 0;
			top: 0;
			bottom: 0;
			z-index: 10;
		}
		&-popup {
			max-height: 80vh;
			padding-top: 37rpx;
			overflow-y: scroll;
			&-title {
				height: 50rpx;
				line-height: 50rpx;
				text-align: center;
				padding-left: 35rpx;
				 color: #000000;
				 position: relative;
				 image {
					 width: 48rpx;
					 height: 48rpx;
					 position: absolute;
					 left: 35rpx;
					 top: 1rpx;
				 }
			}
			&-tips {
				 height: 50rpx;
				 line-height: 50rpx;
				 color: #666666;
				 text-align: center;
				 font-size: 36rpx;
				 margin: 63rpx 0 19rpx 0;
			}
			&-btnwrap {
				padding: 72rpx;
			}
		}
	}
</style>